// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})
// 云函数入口函数
exports.main = async (event, context) => {
  function setTimeDateFmt(s) { // 个位数补齐十位数
    return s < 10 ? '0' + s : s;
  }
  const now = new Date()
  let month = now.getMonth() + 1
  let day = now.getDate()
  let hour = now.getHours()
  let minutes = now.getMinutes()
  let seconds = now.getSeconds()
  month = setTimeDateFmt(month)
  day = setTimeDateFmt(day)
  hour = setTimeDateFmt(hour)
  minutes = setTimeDateFmt(minutes)
  seconds = setTimeDateFmt(seconds)
  let Timeid=now.getFullYear().toString() + month.toString()+ day
  let nowtime=now.getFullYear()+"年".toString() + month.toString()+"月" + day +"日"+ (hour)+":" + minutes;
  let orderCode = 'DB'+now.getFullYear().toString() + month.toString() + day + (hour) + minutes+seconds;
  let upTime=now.getFullYear().toString() + month.toString()+ day+ (hour)+ + minutes+seconds;//上传文件命名规则
  var Timearray=[Timeid,nowtime,orderCode,upTime]
  return Timearray;
}